  <script type="text/javascript"><!--//--><![CDATA[//><!--

    $(document).ready(function() {
        // Setup Form
        $('#form_master').setupForm([
            { name: 'no_tenant', type: 'text', size: 'short', readonly:true , maxlength: 10, },
            { name: 'nama_tenant', type: 'text', size: 'long', maxlength: 200, noempty:true },
            { name: 'jenis_usaha', type: 'text', size: 'long', maxlength: 200, noempty:true },
            { name: 'alamat_lengkap', type: 'text', size: 'long', maxlength: 255, noempty:true },
            { name: 'no_telephone', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'no_handphone', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'lokasi_tempat', type: 'lov', size: 'medium', readonly:true,
                onClearButton:function(){
                    $(this).setval(''); 
                    $('#lokasi_tempat').setval('');
                    $('#id_tempat').setval(''); 
                    $('#no_toko').setval('');
                    $('#harga_sewa').setval('');
                },
                onActionButton:function(){ 
                    LOVTempat({ onSelect:function(row){ 
                        $('#lokasi_tempat').setval(row.lokasi_tempat); 
                        $('#id_tempat').setval(row.id_tempat); 
                        $('#no_toko').setval(row.no_toko);
                        $('#harga_sewa').setval(row.harga_sewa); 
                    } }); 
                }
            },
            //{ name: 'lokasi_tempat2', type: 'text', size: 'short', maxlength: 10, readonly:true },
            { name: 'id_tempat', type: 'text', size: 'short', maxlength: 10, readonly:true },
            { name: 'no_toko', type: 'text', size: 'short', maxlength: 10, readonly:true },
            { name: 'luas_tempat', type: 'text', size: 'short', maxlength: 10, readonly:true },
            { name: 'status_anggota', type: 'text', size: 'medium', maxlength: 255 },
            { name: 'no_anggota', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'no_id_card', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'status_tenant', type: 'text', size: 'medium', maxlength: 255 , readonly:true },
            { name: 'no_kontrak', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'periode_awal_sewa', type: 'date', size: 'medium', maxlength: 20 },
            { name: 'periode_akhir_sewa', type: 'date', size: 'medium', maxlength: 20 },
            { name: 'jangka_waktu', type: 'text', size: 'medium', maxlength: 20 },
            { name: 'harga_sewa', type: 'text', size: 'medium', maxlength: 20 , readonly:true},
            { name: 'keterangan', type: 'text', size: 'medium', maxlength: 255},
        ], <?php echo json_encode($data); ?>);
        
             
        <?php if($mode=="edit"){ ?>
        var id_lokasi_edit = '<?php echo $id_lokasi_edit; ?>';
        var id_sewa_edit = '<?php echo $id_sewa_edit; ?>';
        //alert(id_lokasi);
        $('#no_tenant').readonly();
        $('#id_lokasi').setval(id_lokasi_edit);
        $('#id_sewa').setval(id_sewa_edit);
        <?php } ?>
        
        // Set Action Button
        var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
                            $('#form_master').submitForm(   '/'+controller+'/ajax_post', { onComplete : function(){ loadPage('/'+controller+'/Index') } }); 
                        }},
                       { label: 'Close', icon: 'cancel', onclick: function() { loadPage('/'+controller+'/Index'); } }];
        setAction(buttons);

      
        // Focus at First Object
        $('#form_master').focusFirst();

    });




//--><!]]></script>

<div id="form_master_message" style="display:none;"></div>
    <table class="tb_form" style="width:100%;" cellpadding="0" cellspacing="0">
    <tr>
        <td><input id="id_lokasi" name="id_lokasi" type="hidden" />
            <input id="id_sewa" name="id_sewa" type="hidden" />
        </td>
    </tr>
    <tr>
        <td class="label" style="width:150px">No Tenant</td>
        <td><input id="no_tenant" /><input id="lokasi_tempat2" name="lokasi_tempat2" type="hidden" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Nama Tenant</td>
        <td><input id="nama_tenant" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Jenis Usaha</td>
        <td><input id="jenis_usaha" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Alamat Rumah/Kantor</td>
        <td><textarea id="alamat_lengkap" name="alamat_lengkap" rows="5" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">No Telephone</td>
        <td><input id="no_telephone" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">No Handphone</td>
        <td><input id="no_handphone" /></td>
    </tr> 
    <tr>
        <td class="label" style="width:150px">Lokasi Tempat</td>
        <td><div style="display:none;"><input id="id_tempat" /></div><input id="lokasi_tempat" name="lokasi_tempat">
        </td>
    </tr>
    <tr>
        <td class="label" style="width:150px">No Toko</td>
        <td><input id="no_toko" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Luas Tempat</td>
        <td><input id="luas_tempat" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Status Anggota</td>
        <td>
            <select id="status_anggota" name="status_anggota">
                <option value="null">(Pilih Status)</option>
                <option value="Bukan Anggota">Bukan Anggota</option>
                <option value="Anggota">Anggota</option>
            </select>
        </td>
    </tr>
    <tr id="anggota-hide">
        <td class="label" style="width:150px">No Anggota</td>
        <td><input id="no_anggota" /></td>
    </tr>
    <tr id="anggota-hide2">
        <td class="label" style="width:150px">No ID Card</td>
        <td><input id="no_id_card" /></td>
    </tr>
    <tr>
        <td class="label" style="width:150px">Status Tenant</td>
        <td>
            <select id="status_tenant" name="status_tenant">
                <option value="null">(Pilih Status)</option>
                <option value="Calon Tenant">Calon Tenant</option>
                <option value="Tenant">Tenant</option>
            </select>
        </td>
    </tr>
    <tr id="tenant-hide">
        <td class="label" style="width:150px">No Kontrak</td>
        <td><input id="no_kontrak" /></td>
    </tr>
    <tr id="tenant-hide2">
        <td class="label" style="width:150px">Periode Awal Sewa</td>
        <td><input id="periode_awal_sewa" /></td>
    </tr>
    <tr id="tenant-hide3">
        <td class="label" style="width:150px">Periode Akhir Sewa</td>
        <td><input id="periode_akhir_sewa" /></td>
    </tr>
    <tr id="tenant-hide4">
        <td class="label" style="width:150px">Jangka Waktu</td>
        <td><input id="jangka_waktu" /></td>
    </tr>
    <tr id="tenant-hide5">
        <td class="label" style="width:150px">Harga Sewa</td>
        <td><input id="harga_sewa" /></td>
    </tr>
    <tr id="tenant-hide6">
        <td class="label" style="width:150px">Keterangan</td>
        <td><textarea id="keterangan" name="keterangan" /></td>
    </tr> 
</table>
